package us.kg.kotoriforest.rr;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.io.PrintWriter;

/**
 * ClassName: us.kg.kotoriforest.rr.Servlet3 </br>
 * Description: File Description
 *
 * @author Kotori rotroutine@163.com
 * @since 2024/11/29
 */
@WebServlet("/rr/servlet3")
public class Servlet3 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        resp.sendRedirect("https://kotoriforest.us.kg");
//        resp.setStatus(302);
//        resp.setHeader("Location", "https://kotoriforest.us.kg");
//        resp.setStatus(403);
//        resp.setHeader("key2", "value2");

        resp.setContentType("text/html;charset=UTF-8");
        try (PrintWriter writer = resp.getWriter()) {
            writer.print("你好");
        }

        System.out.println(getServletContext().getContextPath());
    }
}
